package com.example.springtrans.service;

import com.example.springtrans.mapper.LogInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2025-01-28
 * Time: 10:55
 */
@Slf4j
@Service
public class LogService {
    @Autowired
    private LogInfoMapper logInfoMapper;

    @Transactional(propagation = Propagation.NESTED)
    public void insertLog(String name,String op) {
        logInfoMapper.insertLogInfo(name,"用户注册");
        try {
            int a = 10/ 0;
        }catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus();
        }
    }

}
